
import {InjectionToken, NgModule} from "@angular/core";
import {WechatShareConfig} from "../../interface/wechat-share/wechat-share.model";
import {ModuleWithProviders} from "@angular/compiler/src/core";
import {WechatShareService} from "@core/wechat-share/wechat-share.service";

export const WECHAT_SHARE_CONFIG = new InjectionToken('wechatShareConfig');
@NgModule()
export class WechatShareModule {
  static forRoot(wechatShareConfig: WechatShareConfig): ModuleWithProviders {
    return {
      ngModule: WechatShareModule,
      providers: [
        {
          provide: WECHAT_SHARE_CONFIG,
          useValue: wechatShareConfig
        },
        WechatShareService
      ]
    };
  }
}
